using System.Utility.System;
using System.Windows.Media;

namespace System.Utility.Helper
{
	public class ColorHelper
	{
		public ColorHelper()
		{
		}

		public static Color GetHeightColor(Color color)
		{
			Color darkGray;
			try
			{
				short[] num = new short[3];
				byte r = color.R;
				num[0] = TypeExtension.ToInt16(r.ToString());
				r = color.G;
				num[1] = TypeExtension.ToInt16(r.ToString());
				r = color.B;
				num[2] = TypeExtension.ToInt16(r.ToString());
				short[] numArray = num;
				Color color1 = Color.FromRgb(11, 12, 12);
				num = new short[3];
				r = color1.R;
				num[0] = TypeExtension.ToInt16(r.ToString());
				r = color1.G;
				num[1] = TypeExtension.ToInt16(r.ToString());
				r = color1.B;
				num[2] = TypeExtension.ToInt16(r.ToString());
				short[] numArray1 = num;
				int num1 = 2;
				int num2 = 1;
				int[] numArray2 = new int[3];
				for (int i = 0; i < 3; i++)
				{
					numArray2[i] = numArray1[i] + (numArray[i] - numArray1[i]) / num1 * num2;
				}
				Color color2 = Color.FromRgb(BitConverter.GetBytes(numArray2[0])[0], BitConverter.GetBytes(numArray2[1])[0], BitConverter.GetBytes(numArray2[2])[0]);
				darkGray = color2;
			}
			catch
			{
				darkGray = Colors.DarkGray;
			}
			return darkGray;
		}

		public static Color GetLowerColor(Color color)
		{
			Color darkGray;
			try
			{
				short[] num = new short[3];
				byte r = color.R;
				num[0] = TypeExtension.ToInt16(r.ToString());
				r = color.G;
				num[1] = TypeExtension.ToInt16(r.ToString());
				r = color.B;
				num[2] = TypeExtension.ToInt16(r.ToString());
				short[] numArray = num;
				Color color1 = Color.FromRgb(250, 250, 250);
				num = new short[3];
				r = color1.R;
				num[0] = TypeExtension.ToInt16(r.ToString());
				r = color1.G;
				num[1] = TypeExtension.ToInt16(r.ToString());
				r = color1.B;
				num[2] = TypeExtension.ToInt16(r.ToString());
				short[] numArray1 = num;
				int num1 = 2;
				int num2 = 1;
				int[] numArray2 = new int[3];
				for (int i = 0; i < 3; i++)
				{
					numArray2[i] = numArray1[i] + (numArray[i] - numArray1[i]) / num1 * num2;
				}
				Color color2 = Color.FromRgb(BitConverter.GetBytes(numArray2[0])[0], BitConverter.GetBytes(numArray2[1])[0], BitConverter.GetBytes(numArray2[2])[0]);
				darkGray = color2;
			}
			catch
			{
				darkGray = Colors.DarkGray;
			}
			return darkGray;
		}
	}
}